/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utn.tsb.tej.world_logic;

import csm.uttils.generics.Roster;

/**
 *
 * @author Administrator
 */
public class SituationRest extends Situation {

    private String color;
    private Player player;

    public Player getPlayer() {
        return player;
    }

    public SituationRest(String name, String description, String color) {
        super(name, description);
        this.color = color;
    }

    @Override
    public boolean init(Roster<Player> players) {
        boolean out = false;
        for (int i = 0; i < players.count(); i++) {
            if (players.getElementInPosition(i).getColor().getCodeRGB().compareToIgnoreCase(color) == 0) {
                player = players.getElementInPosition(i);
                out = true;
                break;
            }
        }
        return out;
    }
}
